]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay/baseAppView: Update page indicators on page-changed
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Wed, 2 Dec 2020 18:58:49 +0000 (15:58 -0300)
committerMarge Bot <marge-bot@gnome.org>
Wed, 2 Dec 2020 22:43:04 +0000 (22:43 +0000)
The number of pages doesn't depend on the allocated size anymore. Move updating
page indicators from BaseAppView.adaptToSize() to a IconGrid::pages-changed
callback.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1518>

js/ui/appDisplay.js

index 71aee7bc3bc0fc8c220754a94e35ffeb54b316f9..1fd088ebf02acbf5e7e47799917c079965a7ab15 100644 (file)
@@ -138,6 +138,12 @@ var BaseAppView = GObject.registerClass({
         this._grid._delegate = this;
         // Standard hack for ClutterBinLayout
         this._grid.x_expand = true;
+        this._grid.connect('pages-changed', () => {
+            this._adjustment.value = 0;
+            this.goToPage(this._grid.currentPage);
+            this._pageIndicators.setNPages(this._grid.nPages);
+            this._pageIndicators.setCurrentPosition(this._grid.currentPage);
+        });
 
         const vertical = orientation === Clutter.Orientation.VERTICAL;
 
@@ -850,18 +856,6 @@ var BaseAppView = GObject.registerClass({
 
         this._grid.adaptToSize(availWidth, availHeight);
 
-        if (this._availWidth !== availWidth ||
-            this._availHeight !== availHeight ||
-            this._pageIndicators.nPages !== this._grid.nPages) {
-            Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
-                this._adjustment.value = 0;
-                this.goToPage(this._grid.currentPage);
-                this._pageIndicators.setNPages(this._grid.nPages);
-                this._pageIndicators.setCurrentPosition(this._grid.currentPage);
-                return GLib.SOURCE_REMOVE;
-            });
-        }
-
         this._availWidth = availWidth;
         this._availHeight = availHeight;
     }